<?php

namespace App\Models\Application;

use Eloquent as Model;
use Illuminate\Database\Eloquent\SoftDeletes;

/**
 * Class Paneltpl
 * @package App\Models\Application
 * @version July 13, 2018, 6:37 pm CST
 *
 * @property string name
 * @property string areas
 * @property string title
 * @property string subtitle
 * @property string ui
 * @property string description
 */
class Paneltpl extends Model
{
    use SoftDeletes;


    public $table = 'paneltpls';
    

    protected $dates = ['deleted_at'];


    public $fillable = [
        'name',
        'areas',
        'title',
        'subtitle',
        'ui',
        'description',
        'paneltpl_type_id'
    ];

    /**
     * The attributes that should be casted to native types.
     *
     * @var array
     */
    protected $casts = [
        'name' => 'string',
        'areas' => 'string',
        'title' => 'string',
        'subtitle' => 'string',
        'ui' => 'string',
        'description' => 'string'
    ];

    /**
     * Validation rules
     *
     * @var array
     */
    public static $rules = [
        'name' => 'required|max:100'
    ];

    /**
     * paneltpl模板类型
     * @return [type] [description]
     */
    public function paneltplType()
    {
        return $this->hasOne(\App\Models\Application\PaneltplType::class, 'id', 'paneltpl_type_id');
    }
}
